<?php
class stPostcardShare_model extends stmodel_2_1{

    public function __construct($config) {
        parent::__construct ( $config );
        $this->setTableName($this->prefix.'st_postcard_share');
        $this->setPrimaryKey('id');
    }
    
    public function saveStPostcardShare($data) {
        return $this->saveRecords($data);
    }
    
    public function getIdSharedToday($ip, $card_id){
        $month = date('n');
        $day = date('j');
        $year = date('Y');
        $query = "SELECT *
        FROM {$this->_tableName}
        WHERE ip_view like ('$ip')      
        AND card_id = {$card_id}
        AND month(cdate) = {$month}
        AND day(cdate) = {$day}
        AND year(cdate) = {$year}
        ";
//        echo $query;
        $result = $this->get_results($query);
        return $result[0];
    }

    
}